﻿<%

set xml_dom = Server.CreateObject("MSXML2.DOMDocument")     
xml_dom.load request

//sRequest=request
//filepath=server.mappath(".")&"\wx.txt"
//Set fso = Server.CreateObject("Scripting.FileSystemObject")
//set fopen=fso.OpenTextFile(filepath, 8 ,true)
//fopen.writeline(sRequest)
//fopen.writeline("-----")
//set fso=nothing
//set fopen=Nothing

FromUserName=xml_dom.getelementsbytagname("FromUserName").item(0).text
filepath=server.mappath(".")&"\wx.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fopen=fso.OpenTextFile(filepath, 8 ,true)
fopen.writeline(FromUserName)
fopen.writeline("-----")
set fso=nothing
set fopen=Nothing

ToUserName=xml_dom.getelementsbytagname("ToUserName").item(0).text
filepath=server.mappath(".")&"\wx.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fopen=fso.OpenTextFile(filepath, 8 ,true)
fopen.writeline(ToUserName)
fopen.writeline("-----")
set fso=nothing
set fopen=Nothing

Content=xml_dom.getelementsbytagname("Content").item(0).text
filepath=server.mappath(".")&"\wx.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fopen=fso.OpenTextFile(filepath, 8 ,true)
fopen.writeline(Content)
fopen.writeline("-----")
set fso=nothing
set fopen=Nothing

CreateTime=xml_dom.getelementsbytagname("CreateTime").item(0).text
filepath=server.mappath(".")&"\wx.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fopen=fso.OpenTextFile(filepath, 8 ,true)
fopen.writeline(CreateTime)
fopen.writeline("-----")
set fso=nothing
set fopen=Nothing


if Content="Hello" then

   returnstr="Hello, Welcome! "    '表示为新的用户关注

   '0	
   strresponse="<xml>"
   strresponse=strresponse&"<ToUserName><![CDATA["&FromUserName&"]]></ToUserName>"
   strresponse=strresponse&"<FromUserName><![CDATA["&ToUserName&"]]></FromUserName>"
   strresponse=strresponse&"<CreateTime>"&now&"</CreateTime>"
   strresponse=strresponse&"<MsgType><![CDATA[text]]></MsgType>"
   strresponse=strresponse&"<Content><![CDATA["&returnstr&"]]></Content>"
   strresponse=strresponse&"<FuncFlag>0<FuncFlag>"
   strresponse=strresponse&"</xml>"
   response.write strresponse

else
        '做其他的分析处理。
end if


if Content="pig" then

   returnstr="you are big pig !"    '表示为新的用户关注

   '0	
   strresponse="<xml>"
   strresponse=strresponse&"<ToUserName><![CDATA["&FromUserName&"]]></ToUserName>"
   strresponse=strresponse&"<FromUserName><![CDATA["&ToUserName&"]]></FromUserName>"
   strresponse=strresponse&"<CreateTime>"&now&"</CreateTime>"
   strresponse=strresponse&"<MsgType><![CDATA[text]]></MsgType>"
   strresponse=strresponse&"<Content><![CDATA["&returnstr&"]]></Content>"
   strresponse=strresponse&"<FuncFlag>0<FuncFlag>"
   strresponse=strresponse&"</xml>"


filepath=server.mappath(".")&"\wx.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fopen=fso.OpenTextFile(filepath, 8 ,true)
fopen.writeline(strresponse)
fopen.writeline("-----")
set fso=nothing
set fopen=Nothing

   response.write strresponse


else
        '做其他的分析处理。
end if

if Content="p" then


   '回复图文消息
   strresponse="<xml>"
   strresponse=strresponse&"<ToUserName><![CDATA["&FromUserName&"]]></ToUserName>"
   strresponse=strresponse&"<FromUserName><![CDATA["&ToUserName&"]]></FromUserName>"
   strresponse=strresponse&"<CreateTime>"&CreateTime&"</CreateTime>"
   strresponse=strresponse&"<MsgType><![CDATA[news]]></MsgType>"
   strresponse=strresponse&"<Content><![CDATA[test1]]></Content>"
   strresponse=strresponse&"<ArticleCount>2</ArticleCount>"
   strresponse=strresponse&"<Articles>"
   strresponse=strresponse&"<item>"
   strresponse=strresponse&"<Title><![CDATA[美女推荐111]]></Title>"
   strresponse=strresponse&"<Description><![CDATA[111希望找一个成熟稳重一点的男士做朋友]]></Description>"
   strresponse=strresponse&"<PicUrl><![CDATA[http://weixin.lie8.com/test.jpg]]></PicUrl>"
   strresponse=strresponse&"<Url><![CDATA[http://weixin.lie8.com/test111.html]]></Url>"
   strresponse=strresponse&"</item>"
   strresponse=strresponse&"<item>"
   strresponse=strresponse&"<Title><![CDATA[美女推荐222]]></Title>"
   strresponse=strresponse&"<Description><![CDATA[222希望找一个成熟稳重一点的男士做朋友]]></Description>"
   strresponse=strresponse&"<PicUrl><![CDATA[http://weixin.lie8.com/test.jpg]]></PicUrl>"
   strresponse=strresponse&"<Url><![CDATA[http://weixin.lie8.com/test222.html]]></Url>"
   strresponse=strresponse&"</item>"
   strresponse=strresponse&"</Articles>"
   strresponse=strresponse&"<FuncFlag>0</FuncFlag>"
   strresponse=strresponse&"</xml>"


filepath=server.mappath(".")&"\wx.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fopen=fso.OpenTextFile(filepath, 8 ,true)
fopen.writeline(strresponse)
fopen.writeline("-----")
set fso=nothing
set fopen=Nothing

   response.write strresponse

else
        '做其他的分析处理。
end if


//response.write request("echostr")

//response.write request("echostr")
//response.write request("signature")
//response.write request("token")




%>